----------------------------------------------------------------------------------------------------------------------------------
--[[


]]--
----------------------------------------------------------------------------------------------------------------------------------
local hutao_com_cosmic_hat_sys_for_item = Class(function(self, inst)
    self.inst = inst

    self.DataTable = {}
    self.TempTable = {}
    self._onload_fns = {}
    self._onsave_fns = {}



    ------------------------------------------------------------
    --- 双重链接保障
        self.player = nil
        self.userid = ""
        self.__player = net_entity(inst.GUID,"hutao_com_cosmic_hat_sys_for_item.player","net_linked_player")
        self.__userid = net_string(inst.GUID,"hutao_com_cosmic_hat_sys_for_item.userid","net_linked_player")
        inst:ListenForEvent("net_linked_player",function()
            self.player = self.__player:value()
            self.userid = self.__userid:value()
        end)
    ------------------------------------------------------------
    --- bad luck value 
        self.__current = net_float(inst.GUID,"hutao_com_cosmic_hat_sys_for_item.current","bad_luck_value_update")
        self.__max = net_float(inst.GUID,"hutao_com_cosmic_hat_sys_for_item.max","bad_luck_value_update")
        self.__max:set(100)
    ------------------------------------------------------------
end)
------------------------------------------------------------------------------------------------------------------------------
-- 链接玩家
    function hutao_com_cosmic_hat_sys_for_item:LinkPlayer(player)
        self.player = player
        self.userid = player and player.userid or ""
        self.__player:set(player)
        self.__userid:set(self.userid)
    end
    function hutao_com_cosmic_hat_sys_for_item:GetLinkedPlayer()
        if self.player then
            return self.player
        end
        if self.userid then
            for k, temp_player in pairs(AllPlayers) do
                if temp_player.userid == self.userid then
                    return temp_player
                end
            end
        end
        return nil
    end
------------------------------------------------------------------------------------------------------------------------------
-- 
    function hutao_com_cosmic_hat_sys_for_item:SetCurrent(current)
        if TheWorld.ismastersim then
            self.__current:set(current)
        end
    end
    function hutao_com_cosmic_hat_sys_for_item:GetCurrent()
        return self.__current:value()
    end
    function hutao_com_cosmic_hat_sys_for_item:SetMax(max)
        if TheWorld.ismastersim then
            self.__max:set(max)
        end
    end
    function hutao_com_cosmic_hat_sys_for_item:GetMax()
        return self.__max:value()
    end
------------------------------------------------------------------------------------------------------------------------------
return hutao_com_cosmic_hat_sys_for_item







